package com.atguigu.repservice.service.impl;

import com.atguigu.repservice.entity.RepArea;
import com.atguigu.repservice.mapper.RepAreaMapper;
import com.atguigu.repservice.service.RepAreaService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.velocity.runtime.directive.Foreach;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author ZhuangLiJiao
 * @since 2022-02-11
 */
@Service
public class RepAreaServiceImpl extends ServiceImpl<RepAreaMapper, RepArea> implements RepAreaService {

    @Autowired
    private RepAreaMapper repAreaMapper;

    //获取肇庆市内全部区县名称
    @Override
    public List<RepArea> getAllRreaInZhaoQing() {
        List<RepArea> repAreas = repAreaMapper.selectList(null);
        List<RepArea> result = new ArrayList<>();
        for (RepArea a : repAreas) {
            if (!a.getParentId().equals("0")) {
                result.add(a);
            }
        }
        return result;
    }
}
